/*
 * ContainerDelegate.h  0.4.0 / Nov 17, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef CONTAINERDELEGATE_H
#define CONTAINERDELEGATE_H

#include "Cute4jSwing.h"

#include "ComponentDelegate.h"

// ContainerDelegate Class. ----------------------------------------------------

/*!
 * \brief Container Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT ContainerDelegate : public ComponentDelegate
{
  Q_OBJECT
protected:
  ContainerDelegate(JNIEnv *env, jobject obj, QWidget *widget);
  ContainerDelegate(JNIEnv *env, jobject obj);
public slots: // native calls
  void insertChild(JNIEnv *env, jlong childDelegate, jint index);
  void removeChild(JNIEnv *env, jlong childDelegate);
  void validate(JNIEnv *env);
public: // native calls
  static void initialize(JNIEnv *env, jclass cls);
  static jlong newInstance(JNIEnv *env, jobject obj);
protected slots:
  void validateSlot();
signals:
  void validateSignal();
private:
  static jmethodID sm_validateMID;
};

// Macro Definitions. ----------------------------------------------------------

#define CONTAINER_CAST(delegate) \
    (reinterpret_cast<ContainerDelegate *>(delegate))
#define CONTAINER_DELEGATE CONTAINER_CAST(delegate)

#endif // CONTAINERDELEGATE_H
